package com.atguigu.srb.core.controller.admin;

import com.atguigu.common.result.R;
import com.atguigu.srb.core.pojo.entity.UserLoginRecord;
import com.atguigu.srb.core.service.UserLoginRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import java.util.List;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author lupengning
 * @version 1.0
 * @description:
 * @date 2021/6/10 6:25
 */
@Api(tags = "会员登录日志接口")
@RestController
@RequestMapping("/admin/core/userLoginRecord")
//@CrossOrigin
@Slf4j
public class AdminUserLoginRecordController {

  @Resource
  private UserLoginRecordService userLoginRecordService;

  @ApiOperation("获取会员登录日志列表")
  @GetMapping("/listTop50/{userId}")
  public R listTop50(
      @ApiParam(value = "用户id", required = true)
      @PathVariable Long userId) {
    List<UserLoginRecord> userLoginRecordList = userLoginRecordService.listTop50(userId);
    return R.ok().data("list", userLoginRecordList);
  }
}
